package leetcode;

import java.util.Scanner;

public class Day3 {
    /*
    * 杨辉三角
    * */
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int[][] arr=new int[n][n];
            arr[0][0]=1;
            arr[1][0]=1;
            arr[1][1]=1;
            for (int i=2;i<n;i++){
                arr[i][0]=1;
                for (int j=1;j<arr[0].length-1;j++){
                    arr[i][j]=arr[i-1][j-1]+arr[i-1][j];
                }
                arr[i][i]=1;
            }
            for (int i=0;i<n;i++){
                for (int j=0;j<arr[0].length;j++){
                    if(arr[i][j]==0){
                        System.out.print(" ");
                    }else {
                        System.out.print(arr[i][j]);
                    }
                    System.out.print(" ");
                }
                System.out.println("");
            }

        }
    }


    public boolean exist (String[] board, String word) {
        // write code here
        int x=board.length;
        int y=board[0].length();
        char[][] arr=new char[x+2][y+2];
        for (int i=1;i<=x;i++){
            for (int j=1;j<=y;j++){
                arr[i][j]=board[i].charAt(j);
            }
        }
        char w1=word.charAt(0);
        for (int i=0;i<x;i++){
            for (int j=0;j<y;j++){

            }
        }
        return true;
    }
}
